# 有序数列
# list  中括号，可变
# tuple 小括号，不可变（当只有1个元素时，要加逗号区分，避免歧义）
if __name__ == '__main__':
    sampleList = ['Apple', 'Banana', "Cat"]
    print('list:\t', sampleList)
    print('len:\t', len(sampleList))
    print("index1:\t", sampleList[1])

    # 末尾追加
    sampleList.append("Dog")
    sampleList.append([1, 2])
    print("append:\t", sampleList)

    # 指定位置插入
    sampleList.insert(0, "Zero")
    print("insert:\t", sampleList)

    # 删除末尾
    sampleList.pop()
    print("pop:\t", sampleList)

    # 删除指定位置
    sampleList.pop(1)
    print("pop1:\t", sampleList)

    # 删除首个匹配值
    sampleList.remove("Cat")
    print("remove:\t", sampleList)

    # 排序
    sampleList.sort()
    print("sort:\t", sampleList)

    # tuple初始化后不可改变
    sampleTuple = ("Apple", "Banana")
    print(sampleTuple)

    sampleTuple = (1)  # 这是数字，不是tuple！
    print(sampleTuple)

    sampleTuple = (1,)  # 这才是tuple
    print(sampleTuple)
